<?php $this->load->view('header'); ?>
<div id="search-project">
    <?php echo $this->load->view('sideBlocks/searchBlock') ?>
</div>
<!-- Page Content -->
<div class="wrap-content wrap-project insert-score">
    <div class="container">
    <div class="buyer-profile">
    <div class="row">
        <div class="border-green2 border col-md-1 col-xs-1 "></div>
        <div class="container">
        <div class="row title-project">
            <h2 class="quote-55"><?php echo $this->lang->line("insertScore") ?></h2>
        </div>
    </div>
    <div
        class="col-lg-12 col-md-12 col-sm-12 col-xs-12 no-padding profile-user">
    <div class="col-lg-3 col-md-3 col-sm-3 no-padding avatar-user">
        <div class="col-lg-12 col-md-12 col-sm-12 image-avatar-user fix-height">
            <a href="#"><img class="img-responsive"
                             src="<?php if ($user_info['logo'] != '') echo uimage_url($user_info['logo']); else echo image_default(); ?>"></a>
        <div class="col-lg-12 col-md-12 col-sm-12 info-profile-footer">
            <div class="user-row">
                <span>Complaint</span><span
                    class="col-right complaints">0/5</span>
            </div>
            <div class="user-row">
                <span><input id="preview-user" value="<?php echo $user_info['user_rating']?>" type="number"
                             data-star-captions="{}" data-default-caption="{rating}"
                             class="rating" min=0 max=5 data-size="xs">
                </span> 
                <span class="col-right"><?php echo $user_info['num_reviews']?> reviews</span>
            </div>
            <div class="user-row">
                <span><?php echo $this->lang->line('spend') ?></span><span
                    class="col-right price">$5324</span>
            </div>
            <div class="user-row">
                <span><?php echo $this->lang->line('score_now') ?></span>
                <span class="col-right price">
                    <?php if(isset($user_balance['amount']) == TRUE) echo $user_balance['amount'];else echo 0;?> Điểm
                </span>

            </div>
        </div>
    </div></div> <!-- avatar-user -->
    <div class="col-lg-6 col-sm-6 col-md-6 col-xs-12 col-lg-offset-2 info-profile">
        <form action="<?php echo site_url('buyer/insertScore');?>" method="POST" id="form-insertScore" role="form" >
            <div class="form-group">
                <div class="input-group">
                    <div class="input-group-addon"><span class="glyphicon glyphicon-pencil"></span></div>
                    <input type="text" name="score" id="score" class="form-control" placeholder="Please insert only number." />
                </div>
            </div>
            <button class="btn btn-lg btn-primary" id="btn-insert">Insert</button>
            <div style="margin-bottom:10px;"></div> 
        </form>
        <div class="history-score"></div>
        <div style="margin:auto">
            <table class="table table-hover">
                <caption><div class="table-caption">History</div></caption>
                <thead>
                    <tr>
                        <th>STT</th>
                        <th>Điểm cũ</th>
                        <th>Điểm mới</th>
                        <th>Ngày</th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                <?php
                    $i = 1;
                    foreach ($history as $h) {
                ?>
                    <tr>
                        <td><?php echo $i; ?></td>
                        <td><?php echo $h->amount_old;?></td>
                        <td><?php echo $h->amount_new;?></td>
                        <td>
                            <?php
                                if(date("d/m/y") == date("d/m/y",$h->created))
                                       echo "Hôm nay";
                                else
                                       echo date("d/m/Y", $h->created);
                            ?>
                        </td>
                        <!-- <td><a href="">Xóa</a></td> -->
                    </tr>
                <?php
                    $i++;}
                ?>
                    
                </tbody>
            </table>
            <div style="text-align:center"><?php echo $pagination;?></div>
        </div>
        
    </div>
    </div>
    </div><!-- row -->
    <div class="col-md-12">
    <div class="quote-last-55"></div>
</div>
    </div>
    </div>
</div><!-- wrap-content -->

	

     <script type="text/javascript">
        $("#form-insertScore").validate({
            rules:{
                score:{
                    required: true,
                    number : true,
                }
            },
            messages:{
                score:{
                    required: "Please fill the score field.",
                    number : "Please insert only number."
                }
            }
        }); 
    </script>

<?php $this->load->view('footer'); ?>